package com.novel.controller;

import com.novel.service.HistoryTagsService;
import com.reading.pojo.HistoryTags;
import com.reading.pojo.HistorytagsVo;
import com.reading.vo.Rmed;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("history")
public class HistoryTagsController {

    @Autowired
    private HistoryTagsService historyTagsService;


    @RequestMapping("/findHistoryContent")
    public List<String> findHistoryContent(Integer userId){
        return historyTagsService.findHistoryContent(userId);
    }

    @RequestMapping("/findAll")
    public List<HistoryTags> findAll(Integer userId){
        return historyTagsService.findAll(userId);
    }

    @RequestMapping("/deleteAllHistory")
    public Rmed deleteAllHistory(Integer userId){
        historyTagsService.deleteAllHistory(userId);
        return Rmed.suceess();
    }

    @RequestMapping("/saveHistory")
    public void saveHistory(@RequestBody HistoryTags historyTags){
        historyTagsService.saveHistory(historyTags);
    }

    @RequestMapping("/findOne")
    public HistoryTags findOne(@RequestBody HistorytagsVo historytagsVo){
        return historyTagsService.findOne(historytagsVo);
    }

    @RequestMapping("/updateTags")
    public void updateTags(@RequestBody HistorytagsVo historytagsVo){
        historyTagsService.updateTags(historytagsVo);
    }

}
